package thread;

public class ThreadInfoDemo {
    public static void main(String[] args) {
        Thread t=Thread.currentThread();//获取主线程
        String name=t.getName();
        System.out.println("name:"+name);


        long id=t.getId();//获取唯一标识
        System.out.println("id:"+id);

        int priority=t.getPriority();//获取线程优先级1-10，默认为5
        System.out.println("优先级："+priority);

        boolean isAlive=t.isAlive();
        boolean isDaemon=t.isDaemon();
        boolean isInterrupted=t.isInterrupted();
        System.out.println("isAlive:"+isAlive);
        System.out.println("isDamon:"+isDaemon);
        System.out.println("isInterrupted:"+isInterrupted);

    }
}
